/* eslint-disable */
// 该文件由 OneAPI 自动生成，请勿手动修改！
import {apiPrefixDispose} from '@/utils/format';
import {request} from '@umijs/max';


/**
 * 查询菜单
 */
export async function select<T = any>(body: API.MenuPage) {
  return request<API.ResultPageVO<API.MenuVO>>(apiPrefixDispose('/menu/select'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}


/**
 * 新增菜单
 */
export async function add<T = any>(body: API.MenuAdd) {
  return request<API.ResultVO<API.MenuVO>>(apiPrefixDispose('/menu/add'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}




/**
 * 修改菜单
 */
export async function alter<T = any>(body: API.MenuAlter) {
  return request<API.ResultVO<string>>(apiPrefixDispose('/menu/alter'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}


/**
 * 删除菜单
 */
export async function deleteByCodes<T = any>(
  codes: Array<string>,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose(`/menu/delete`), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: codes,
    ...(options || {}),
  });
}


/**
 * 启用菜单
 */
export async function enabled<T = any>(
  codes: Array<string>,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose(`/menu/enabled`), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: codes,
    ...(options || {}),
  });
}

/**
 * 禁用菜单
 */
export async function disable<T = any>(
  codes: Array<string>,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose(`/menu/disable`), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: codes,
    ...(options || {}),
  });
}



/**
 * 根据code获取下一级的子节点(默认所有)
 * @param  code 节点编码
 * @param  status 节点状态（0、禁用；1、启用） 不传默认查所有
 * @param  type 类型（0、节点；1、功能；2、按钮） 不传默认查所有
 */
export async function getChild<T = any>(
  params: {code: string, status?:number,type?:number},
  options?: { [key: string]: any },
) {
  // console.log("getChild", params);
  return request<API.ResultVO<API.MenuVO[]>>(apiPrefixDispose('/menu/getChild'), {
    method: 'GET',
    params: { ...params },
    ...(options || {}),
  });
}


/**
 * 菜单树
 */
export async function tree<T = any>() {
  return request<API.ResultVO<[]>>(apiPrefixDispose('/menu/tree'), {
    method: 'GET',
  });
}
